package com.jule.chat;

import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.joran.JoranConfigurator;
import ch.qos.logback.core.joran.spi.JoranException;
import com.jule.chat.config.Config;
import com.jule.chat.network.WSIOServer;
import org.slf4j.LoggerFactory;

public class Main {
    public static void main(String[] args){
        initLogConfig();
        Config.load();
        WSIOServer.connect();
    }

    public static void initLogConfig(){
        LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
        try {
            JoranConfigurator configurator = new JoranConfigurator();
            configurator.setContext(lc);
            lc.reset();
            configurator.doConfigure("config/logback.xml");
        } catch (JoranException je) {
            throw new RuntimeException("Failed to configure loggers, shutting down...", je);
        }
    }
}
